package com.jfinal.plugin.sqlbuilder.func;

import com.jfinal.plugin.sqlbuilder.IFunction;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class LikeFunction implements IFunction {

    @Override
    public String replaceSql(String args) {
        return " like ? ";
    }

    @Override
    public List<Object> getParams(String args, Map<String, Object> params) {
        List<Object> result = new ArrayList<Object>();
        Object value = params.get(args.trim());
        result.add("%" + value + "%");
        return result;
    }

}
